﻿using System.Diagnostics.Contracts;
using SpotOffer.Resource;
using SpotOffer.Utils;
using Xamarin.Forms;
using XLabs.Forms.Controls;

namespace SpotOffer.CustomViews
{
    public class AppViews
    {
        public static int ItemHeight = 35;
        public static double LabelFontMultiplier = 1;

        public static ExtendedLabel ItemLabel()
        {
            var itemlabel = new ExtendedLabel
             {
                 VerticalOptions = LayoutOptions.Center,
                 YAlign = TextAlignment.Center,
                 FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                 HeightRequest = ItemHeight,
                 TextColor = AppColors.White,
              /*   FontName = "Plane.ttf",
                 FriendlyFontName = "Plane"*/
             };
            return itemlabel;
        }

        public static ExtendedLabel SettingsLabel()
        {
            var itemlabel = new ExtendedLabel
            {
                VerticalOptions = LayoutOptions.CenterAndExpand,
                YAlign = TextAlignment.Center,
                FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                HeightRequest = ItemHeight,
                TextColor = AppColors.DarkbluLight,
                BackgroundColor = Color.Transparent,
              /*  FontName = "Plane.ttf",
                FriendlyFontName = "Plane"*/
            };
            return itemlabel;
        }

        public static ExtendedLabel OrangeLabel()
        {
            var itemlabel = new ExtendedLabel
            {
                TextColor = AppColors.White,
                BackgroundColor = AppColors.Laranja,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                XAlign = TextAlignment.Center,
                YAlign = TextAlignment.Center,
                FontSize = (Device.GetNamedSize(NamedSize.Small, typeof(Label))) * LabelFontMultiplier,
                HeightRequest = ItemHeight,
             /*   FontName = "Plane.ttf",
                FriendlyFontName = "Plane"*/
            };
            return itemlabel;
        }


        public static ContentView ItemContentView(ExtendedLabel extendedLabel)
        {
            var itemContenView = new ContentView
            {
                Padding = new Thickness(10, 0, 0, 0),
                Content = extendedLabel,
            };
            return itemContenView;
        }

        public static StackLayout ContentStackLayout()
        {
            return new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = AppColors.LighterGrey,
                Padding = new Thickness(4, 4, 4, 4)
            };
        }

        public static ListView ReturnListView()
        {
            var listview = new ListView
            {
                SeparatorVisibility = SeparatorVisibility.None,
                RowHeight = ItemHeight,
                HasUnevenRows = false,
                
            };
            return listview;
        }


        public class ButtonSpotOffer : Button
        {
            public ButtonSpotOffer()
            {
                FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Button));
                BackgroundColor = AppColors.DarkbluLightest;
                TextColor = AppColors.White;
                BorderRadius = 5;
                
            }
        }


        public class FrontPage : ContentPage
        {
            public FrontPage()
            {
                var layout = new StackLayout
                {
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.CenterAndExpand,

                };
                var frontimg = new Image
                {
                    Source = "loader.png",
                };
                layout.Children.Add(frontimg);
                Title = "GetFrontPage";

                BackgroundColor = AppColors.White;
                Content = layout;
            }
        }

        public class SpotOfferLabel : ExtendedLabel
        {
            public SpotOfferLabel()
            {
                FontSize = (Device.GetNamedSize(NamedSize.Small, typeof (Label)));
                TextColor = AppColors.DarkbluLighter;
                LineBreakMode = LineBreakMode.CharacterWrap;
               /* FontName = "Plane.ttf";
                FriendlyFontName = "Plane";*/
            }
        }

    }
}
